package demo2;

import com.mysql.jdbc.jdbc2.optional.MysqlDataSource;

import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

public abstract class Student {
    public DataSource dataSource ;
    public Connection connection ;
    public PreparedStatement preparedStatement ;

    public Student() {
        dataSource = new MysqlDataSource();
        ((MysqlDataSource) dataSource).
                setUrl("jdbc:mysql://127.0.0.1:3306/java109?characterEncoding=utf8&useSSL=false");
        ((MysqlDataSource) dataSource).setUser("root");
        ((MysqlDataSource) dataSource).setPassword("0118");

        try {
            connection = dataSource.getConnection();
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }

    }
    public void select(){
    }



}
